<?php
/**
 * 排行榜首页控制层
 * 
 * @copyright 	Copyright (c) 2011 thinkapk.com All rights reserved.
 * @package 	ThinkAPK_Action
 * @link 		http://www.thinkapk.com/
 * @author 		richie <richbossman@163.com>
 * @version 	$Id: Top.class.php 7569 2011-06-01 12:49:11Z richie $
 * 
 */
class TopAction extends ThinkAPK_Action_Web {
	
	private $Id;
	
	function index(){
		$this->Id = isset($_GET['id'])?intval($_GET['id']):'';
		//列表
		$this->assign('cates', D('Category')->get(0, 'Top'));
		$this->assign('app_id', $this->Id);
		if($this->Id){
			$cat = D('Category')->where('is_show=1 AND cat_id='.$this->Id)->field('keywords,cat_name as name,cat_desc')->find($this->Id);
			if(empty($cat)){
				$this->error();
			}
			$this->assign('cat', $cat);
			$title = 'Android'.$cat['name'].'下载排行榜TOP50';
			$here = 'Android'.$cat['name'].'下载排行TOP50';
			$tops = D('GoodsCount')->get($this->Id, 51);
			$this->assign('showpage', 'pagecate');
		}elseif($this->Id === ''){
			$cat['name']=$cat['keywords'] = $cat['cat_desc'] = '';
			$title = 'Android应用、游戏下载排行榜';
			$here = $title;
			$tops = D('Category')->getTops();
			$this->assign('showpage', 'pagetop');
		}
		$this->assign('tops', $tops);
		//页面属性
		$this->setTitle($title);
		$this->setKeywords($cat['keywords'].'Android,Android游戏,软件,安卓软件,安卓软件下载');
		$this->setDescription($cat['cat_desc'].'创想安卓Android应用软件、游戏下载排行榜');
		$this->setPosition(0, $here);
		unset($title, $cat, $here);
		$this->display();
	}
}
?>